import { timePickerDefaultProps } from "element-plus";
import instance from "./http";
import { bookInfo, userRegisterI,mydataRegisterI } from "./type";

//你就不能直接使用export  default  导出
//已经配置了baseUrl，所以这里直接写路由即可，不用 /api  userinfo:{username:'', passwd:''}

//上传商品信息到服务器
//post请求
export const goodsInfo = (bookinfo: bookInfo) =>
    instance.post('/uploadBook', bookinfo);

//获取书本的信息
//get请求
export const getgoodsInfo = (category: number) =>
    instance.get('/getBookInfo', { params: { category } });


export const updataStatus = (id: number) =>
    instance.get('/updataStatus', { params: { id } });

export const getNums = () =>
    instance.get('/getAllNums');



//拿到商品信息
export const getcommodity = (id: number) => {
  return instance.get('/getcommodity', {
    params: { id },
  });
};
//添加商品清單
export const commodityList = (listdata: any) => {
  return instance.post('/commodityList', listdata);
};
//獲取商品清單
export const getCommodityList = () => {
  return instance.get('/getCommodityList');
};

//收藏商品
export const collects = (id:number) => {
  return instance.post('/collects', {id});
};
//獲取收藏的商品信息
export const getCollectCommodity = () => {
  return instance.get('/getCollectCommodity');
};
//刪除商品
export const delcommodity = (id: number) => {
  return instance.get('/delcommodity', {
    params: { id },
  });
};

// 获取拍品详情
// export const getarticle = (aid: any) =>
//   instance.get("/getarticle", { params: { aid } });

// 提交商品拍价纪录
export const bidrecord = (submitdata: any) =>
  instance.post("/bidrecord", submitdata);

//获取商品拍价记录getbidrecord
export const getbidrecord = (uid: any) =>
instance.get("/getbidrecord", { params: { uid } });


export const getShopData = (id: any) =>
instance.get("/getShopData", { params: { id } });



// export const userRegister = (userinfo: userRegisterI) =>
//   instance.post("/reg", userinfo);

// //用户登录
// export const userLogin = (userinfo: userRegisterI) =>
// instance.post("/editorlogin", userinfo);

//获取验证码
export const getcode = (phone:any)=>
instance.get('/send',{params:{phone}});
//注册
export const regLogin = ( ruleForm:mydataRegisterI) =>
instance.post("/regLogin",  ruleForm);
//登录
export const loginn = ( formLabelAlign:any) =>
instance.post("/login",  formLabelAlign);
//短信登录
export const phoneMessageLogin = (  ruleForm:any) =>
instance.post("/messageLogin",   ruleForm);
//重置密码
export const resPasswdLogin= ( ruleForm:any) =>
instance.post("/resPasswdLogin",  ruleForm);

//修改密码
export const modfityPasswd= ( ruleForm:any) =>
instance.post("/modfityPasswd",  ruleForm);

//个人资料
export const pesonmodfity= ( ruleForm:any) =>
instance.post("/pesonZl",  ruleForm);
//获取到最新的数据渲染个人资料
export const Rsultpesonmodfity= ( uid:any) =>
instance.get('/Personsend',{params:{uid}} );

